<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div>
<h1 id="swstatus" style="color:crimson;"></h1>
</div>
<script>
if(/^http:/.test(window.location)) 
	window.location = window.location.replace(/^http/, "https"); 
if ('serviceWorker' in navigator) {
	window.addEventListener('load', function () {
		navigator.serviceWorker.register('./sw.js', {scope: './'})
		.then(function (registration) {
			console.log('ServiceWorker registration successful with scope: ', registration.scope); 
			window.location = "./"; 
		})
		.catch(function (err) {
			console.log('ServiceWorker registration failed: ', err); 
			document.getElementById("swstatus").innerText = "注册Service Workers失败。这可能是一个网络错误。"; 
		});
	});
}
else 
	document.getElementById("swstatus").innerText = "注册Service Workers失败。您的浏览器可能不支持这项技术。"; 
</script>
</body>
</html>